package com.hunau.novel_reading.service.impl;

import com.hunau.novel_reading.entity.Books;
import com.hunau.novel_reading.mapper.FavoritesMapper;
import com.hunau.novel_reading.request.FavoritesInsertReq;
import com.hunau.novel_reading.request.FavoritesSeekReq;
import com.hunau.novel_reading.service.FavoritesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FavoritesServiceImpl implements FavoritesService {
    @Autowired
    private FavoritesMapper favoritesMapper;
    @Override
    public Integer insertFavoritesRecordByUserAndBookName(FavoritesInsertReq favoritesInsertReq) {
        return favoritesMapper.insertFavoritesRecordByUserAndBookName(favoritesInsertReq.getUsername(), favoritesInsertReq.getBookName());
    }
    @Override
    public List<Books> selectBooksByUsername(FavoritesSeekReq favoritesSeekReq) {
        return favoritesMapper.selectBooksByUsername(favoritesSeekReq.getUsername());
    }
}
